package com.ycz.cglib.dispatcher;

import com.ycz.cglib.load.PropertyBean;
import lombok.Data;
import org.springframework.cglib.proxy.Enhancer;

/**
 * @author ycz
 * @date 2021/7/3
 * @description TODO
 * @Company © 版权所有 深圳市天行云供应链有限公司
 */
@Data
public class DispatcherBean {

    private String name;
    private String value;
    private PropertyBean propertyBean;

    public DispatcherBean() {
        this.name = "ycz";
        this.value = "18";
        this.propertyBean = createDispatcherBean();
    }

    public PropertyBean createDispatcherBean(){
        Enhancer enhancer = new Enhancer();
        enhancer.setSuperclass(PropertyBean.class);
        return (PropertyBean) enhancer.create(PropertyBean.class,new ConcreteClassDispatcher());
    }
}
